﻿using ConfExpert.Forms.Base;
using DevTeam;

using System;
namespace ConfExpert.Forms.Depo._7C
{
    public partial class CikilanEnler : XForm
    {
        int CikisPartisiId = 0;
        public CikilanEnler(int cikisPartisiId)
        {
            InitializeComponent();
            CikisPartisiId = cikisPartisiId;
        }

        private void CikilanEnler_Load(object sender, EventArgs e)
        {

            gridView1.Init("GetKesimEn", CikisPartisiId, false);
            gridView1.AddDetailGrid(gridView2, "ProductId", 1);
            gridView1.AddDetailGrid(gridView3, "ProductId", 2);

            gridView3.FormatAsNumber(1, "En");
            gridView3.AddSummary("Qty", "Adet");

            splitContainerControl1.AutoSize();
            splitContainerControl2.AutoSize();

            chk.CheckedChanged += chk_CheckedChanged;
        }

        void chk_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            gridView1.RefreshDataSource(true, "GetKesimEn", CikisPartisiId, chk.Checked);
            gridView3.FormatAsNumber((chk.Checked ? 0 : 1), "En");
            gridView3.BestFitColumns();
        }
    }
}